package week02

// 104. 二叉树的最大深度
// https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/

func maxDepth(root *TreeNode) int {
	if root == nil {
		return 0
	}
	var left = maxDepth(root.Left) + 1
	var right = maxDepth(root.Right) + 1
	return max(left, right)
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

type TreeNode struct {
	Val int
	Left *TreeNode
	Right *TreeNode
}
